<?php

namespace App\Http\Controllers\Web\Seller;

use App\ConstDir\ErrorConst;
use App\Http\Controllers\Web\BaseController;

use App\Repository\Models\Shop;
use App\Repository\Repositories\Interfaces\ShopCategoriesRepository;
use App\Repository\Repositories\Interfaces\ShopTempleteRepository;
use Illuminate\Http\Request;

/**
 * 订单管理控制器
 *
 * @package App\Http\Controllers\Backend
 */
class ShopTempleteController extends BaseController
{
    /**
     * @var
     */
    protected $shoptemplete;

    protected $shop_id;

    public function __construct(ShopTempleteRepository $shoptemplete)
    {
        parent::__construct();
        $this->shoptemplete = $shoptemplete;
        $this->shop_id = array_get($this->user, 'shop_id');

    }

    public function index()
    {
        $res = $this->shoptemplete->paginate($this->perPage);

        return $this->success(ErrorConst::SUCCESS_CODE_MSG, $res, true);
    }


    public function store(Request $request)
    {

    }

    public function update(Request $request, $id)
    {
//        dd($id);

        $redata=$request->all();
        $data['sp_templete']=$redata['id'];
        $res=Shop::query()->where('sp_id',$this->shop_id)->update($data);
        return $this->success(ErrorConst::SUCCESS_CODE_MSG, $this->shop_id, true);

    }




}
